<template>
  <span v-formatTime>{{ time }}</span>
</template>

<script>
import moment from 'moment'
export default {
  directives: {
    formatTime: {
      mounted(el, bindings, vnode, preVnode) {
        console.log(el.innerText)
        el.innerText = moment(el.innerText * 1).format('YYYY-MM-DD')
      },
    },
  },
  setup() {
    const time = '1648459124914'
    return {
      time,
    }
  },
}
</script>

<style scoped></style>
